package finman.database;

class Valuta {
	private String name;
	private String description;
	
	Valuta(String name) throws IllegalArgumentException {
        name = name.toLowerCase();
        if("usd".equals(name)) {
            description = "";
        } else if("eur".equals(name)) {
            description = "";
        } else if("gbp".equals(name)) {
            description = "";
        } else if("jpy".equals(name)) {
            description = "";
        } else if("rub".equals(name)) {
            description = "";
        } else if("uah".equals(name)) {
            description = "";
        } else {
            throw new IllegalArgumentException("Unsupported currency name: " + name);
        }
		this.name = name;
	}

    @Override
    public boolean equals(Object obj) {
        if(!(obj instanceof Valuta)) return false;

        Valuta valuta = (Valuta) obj;
        return valuta.getName().equals(name) &&
               valuta.getDescription().equals(description);
    }

    ////////////////////////////////////// ACCESSORS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
    public String getName() {
        return name;
    }

    public String getDescription() {
        return description;
    }
}